package com.lanxiao.cloud.modules.gateway.route.application.query;

import com.lanxiao.cloud.modules.gateway.route.application.dto.GatewayRouteQuery;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

/**
 * @author ：qiaoliang
 * @date ：2021-09-14
 */
public class RouteLambdaQuery {
  private final String serviceId;
  private final String uri;
  private final String predicates;
  private final String filters;
  private final Long createdBy;

  public static RouteLambdaQuery toRouteLambdaQuery(GatewayRouteQuery query) {
    return RouteLambdaQueryConverter.INSTANCE.toRouteLambdaQuery(query);
  }

  @Mapper
  public interface RouteLambdaQueryConverter {
    RouteLambdaQueryConverter INSTANCE = Mappers.getMapper(RouteLambdaQueryConverter.class);

    RouteLambdaQuery toRouteLambdaQuery(GatewayRouteQuery query);

  }

  public RouteLambdaQuery(String serviceId, String uri, String predicates, String filters,
      Long createdBy) {
    this.serviceId = serviceId;
    this.uri = uri;
    this.predicates = predicates;
    this.filters = filters;
    this.createdBy = createdBy;
  }

  public String getServiceId() {
    return serviceId;
  }

  public String getUri() {
    return uri;
  }

  public String getPredicates() {
    return predicates;
  }

  public String getFilters() {
    return filters;
  }

  public Long getCreatedBy() {
    return createdBy;
  }
}
